package service

import (
	"context"
	v1 "{{cookiecutter.__project_name_snake}}/api/{{cookiecutter.__app_name_pkg}}/v1"
	"{{cookiecutter.__project_name_snake}}/internal/biz"
)

// {{ cookiecutter.__app_name_camel }}Service is a {{ cookiecutter.__app_name_camel }} service.
type {{ cookiecutter.__app_name_camel }}Service struct {
	v1.Unimplemented{{ cookiecutter.__app_name_camel }}Server

	uc *biz.{{ cookiecutter.__app_name_camel }}Usecase
}

// New{{ cookiecutter.__app_name_camel }}Service new a {{ cookiecutter.__app_name_camel }} service.
func New{{ cookiecutter.__app_name_camel }}Service(uc *biz.{{ cookiecutter.__app_name_camel }}Usecase) *{{ cookiecutter.__app_name_camel }}Service {
	return &{{ cookiecutter.__app_name_camel }}Service{uc: uc}
}

// SayHello implements helloworld.{{ cookiecutter.__app_name_camel }}Server.
func (s *{{ cookiecutter.__app_name_camel }}Service) SayHello(ctx context.Context, in *v1.HelloRequest) (*v1.HelloReply, error) {
	g, err := s.uc.Create{{ cookiecutter.__app_name_camel }}(ctx, &biz.{{ cookiecutter.__app_name_camel }}{Hello: in.Name})
	if err != nil {
		return nil, err
	}
	return &v1.HelloReply{Message: "Hello " + g.Hello}, nil
}
